<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>意向客户管理</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css"/>
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .table > tbody > tr > td {
            height: 24px;
            max-height: 24px;
            overflow: hidden;
            position: relative;
        }

        .jiu {
            position: absolute;
            width: 10px;
            height: 10px;
            top: 2px;
            right: 2px;
            background: url("/dist/img/jiu.png");
        }

        .moduleName {
            float: left;
            height: 27px;
            line-height: 27px;
            font-size: 22px;
            width: 100px;
            text-align: center;
        }

        .tryStyle {
            width: 30px;
            height: 14px;
            line-height: 14px;
            font-size: 12px;
            /* top: 0; */
            right: 0;
            position: absolute;
            border-radius: 5px;
            margin-top: 1px;
            background: red;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.8);
        }

        .nav-tabs-custom {
            margin-bottom: 0;
            box-shadow: none;
            position: relative;
        }

        span.lineOne {
            line-height: 27px !important;
            height: 28px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .table-detail td.twoLine {
            line-height: 1.5 !important;
            padding: 3px 0 !important;
        "
        }

        .table-detail select {
            text-indent: 0 !important;
            padding-left: 0 !important;
            margin-left: -4px !important;
        }

        .fixed-table_body tr td {
            border-right: none;
            font-size: 12px;
            text-align: center;
        }

        .fixed-table_header tr th {
            border-right: none;
            background: yellow;
            font-weight: normal;
            font-size: 12px;
        }

        .fixed-table_body tr:nth-of-type(odd) {
            background: #F9F9F9;
        }

        .gray td {
            color: #CCCCCC !important;
        }
        .bold{
            font-weight: bold;
        }
        .btn-blue {
            border: none;
            background: #2a8cec;
            color: #fff;
            font-size: 16px;
            height: 48px;
            width: 100%;
            border-radius: 2px;
            outline: none;
            position: fixed;
            left: 0;
            bottom: 0;
            font-weight: bold;
        }

        .btn-blue:active {
            border: none;
            background: #356698;
            opacity: 0.8;
            color: #fff;
            font-size: 16px;
            height: 48px;
            width: 100%;
            border-radius: 2px;
            outline: none;
            position: fixed;
            left: 0;
            bottom: 0;
            font-weight: bold;
        }

        .btn-blue.focus, .btn-blue:focus, .btn-blue:hover {
            color: #fff;
            text-decoration: none;

        }
    </style>
</head>
<body>
<section class="content" id="app">
    <iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
    <div class="div-td-content-more"><i></i></div>

    <div class="box-body no-padding iframeH3" style="overflow: auto;" id="scrollDiv">
        <div id="progress" class="wyui-progress"></div>
        <div class="fixed-table-box head-fixed ">
            <div class="fixed-table_header-wraper">
                <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                    <tr>
                        <th style="width:60px;">
                            <div class="table-cells">客户</div>
                        </th>
                        <th style="width:100px;">
                            <div class="table-cells">电话</div>
                        </th>
                        <th style="width:60px;">
                            <div class="table-cells">意向品牌</div>
                        </th>
                        <th style="width:110px;">
                            <div class="table-cells">意向机型</div>
                        </th>
                        <th style="width:70px;">
                            <div class="table-cells">成交时间</div>
                        </th>
                        <th style="width:70px;">
                            <div class="table-cells">成交概率</div>
                        </th>
                        <th style="width:70px;">
                            <div class="table-cells">状态</div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
            <div class="fixed-table_body-wraper iframeFixed">
                <table class="fixed-table_body table-hover" cellspacing="0" cellpadding="0" border="0"
                       style="width: 100%;">
                    <tbody id="tbList">
                    <tr v-for="(item,i) in customerList">
                        <td :class="isUnDone(item)?'bold':''" style="width:60px;color: rgb(42, 140, 236);cursor:pointer" @click="openDetail(item.customerId,0)">
                            <span >{{item.customerName}}</span>
                        </td>
                        <td :class="isUnDone(item)?'bold':''"  style="width:100px;" ><span
                                class="lineOne">{{item.customerTel}}</span>
                        </td>
                        <td :class="isUnDone(item)?'bold':''"  style="width:60px;"><span class="lineOne">{{item.intentionBrand}}</span>
                        </td>
                        <td :class="isUnDone(item)?'bold':''"  style="width:110px;"><span class="lineOne">{{item.intentionModel}}</span>
                        </td>
                        <td :class="isUnDone(item)?'bold':''"  style="width:70px;"><span class="lineOne">{{changeBuyDate(item.buyDate)}}</span>
                        </td>
                        <td :class="isUnDone(item)?'bold':''"  style="width:70px;"><span class="lineOne">{{item.chance}}</span>
                        </td>
                        <td v-if="isToday(item)" :class="isUnDone(item)?'bold':''"  style="width:70px;"><span class="lineOne">今日未维护</span>
                        </td>
                        <td v-else :class="isUnDone(item)?'bold':''"  style="width:70px;"><span class="lineOne">{{isUnDone(item)?"资料不全":"今日已维护"}}</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <button type="button" class="btn btn-blue" style="border-top: 1px solid white"
                @click="openDetail('','1')">新增意向客户
        </button>

    </div>

</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/plugins/fixedTable/fixed-table.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + 12 + "px",
                        "left": $(this).offset().left - 6,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    function refresh() {
        $.wyui.page.getByPage();
    }

    var app = new Vue({
        el: '#app',
        data: {
            userId: $.wyui.page.urlParams.userId ? $.wyui.page.urlParams.userId : getCurrentUser().id,
            companyId: $.wyui.page.urlParams.companyId ? $.wyui.page.urlParams.companyId : getCurrentUser().companyId,
            reportDate:$.wyui.page.urlParams.reportDate ? $.wyui.page.urlParams.reportDate : '',
            searchParams: {
                userId: this.userId,
                key: '',
                buyDate: '',
            },
            customerList: [],
        },

        methods: {
            openDetail: function (customerId,isAdd) {
                var that = this;
                var url = '/page/intentionManagement/quYuIntentionalDetailApp.html?customerId=' + customerId + '&isAdd='+isAdd+'&pageType=edit&userId=' + that.userId + '&companyId=' + that.companyId + '&isRegion=1&type=pcList';
                var H = $(window).height() - 50;
                $.dialog({
                    content: 'url:' + url,
                    title: "意向客户详情",
                    width: 500,
                    height: H,
                    max: true,
                    min: true,
                    lock: true
                });
            },
            isToday:function(item){
                if (item.updateTime != new Date().Format("yyyy-MM-dd")){
                    return true;
                } else{
                    return false;
                }
            },
            changeBuyDate:function(buyDate){
                var a='';
                switch (buyDate) {
                    case 'todayMonth':
                        a='本月内'
                        break
                    case 'nextMonth':
                        a='下月内'
                        break
                    case 'threeMonth':
                        a='三月内'
                        break
                    case 'halfYear':
                        a='半年内'
                        break
                }
                return a;
            },
            isUnDone: function (item) {
                if (
                    (
                        item.customerName == "" ||
                        item.customerTel == "" ||
                        item.customerType == "" ||
                        item.customerCredit == "" ||
                        item.source == "" ||
                        item.chance == "" ||
                        item.countyName == "" ||
                        item.intentionBrand == "" ||
                        item.intentionModel == "" ||
                        item.existingDevice == "" ||
                        item.buyDate == "" ||
                        item.workingExperience == "" ||
                        item.buildCondition == "" ||
                        item.revenueForecast == "" ||
                        item.competitorCondition == ""||
                        item.updateTime != new Date().Format("yyyy-MM-dd")
                    )
                ) {
                    return true
                } else {
                    return false
                }
            },
            search: function () {
                $.wyui.page.queryParams.requestPage = 1;
                $.extend($.wyui.page.queryParams, trimRN(this.searchParams));
                console.log($.wyui.page.queryParams);
                $.wyui.page.getByPage();
            },
//            refreshList:function () {
//                var that=this;
//                $.wyui.postMethod('/intentionCustomerManagement/getCustomerListByCreateUserId.json', {'userId': that.userId}, function (r) {
//                    that.customerList = r.records;
//                })
//            }
            refreshList:function () {
                var that=this;
                $.wyui.postMethod('/intentionCustomerManagement/getRegionCustomerByUserIdAndReportDate.json', {'userId': that.userId,'reportDate':that.reportDate}, function (r) {
                    that.customerList = r;
                })
            }
        },
        mounted: function () {
            this.refreshList();

        }
    });

</script>
<script>
    //初始化FixedTable
    $(".fixed-table-box").fixedTable();
</script>
</body>
</html>